import Mock from "mockjs";
//处理路径传参
// import { parameteUrl } from "@/utils/query-param"

function ArrSet(Arr, id){
    let obj = {}
    const arrays = Arr.reduce((setArr, item) => {
        obj[item[id]] ? '' : (obj[item[id]] = true && setArr.push(item))
        return setArr
    }, [])
    return arrays
}
/**
* @description: min ≤ r ≤ max  随机数
* @param {*} Min
* @param {*} Max
* @return {*}
*/
function RandomNumBoth(Min, Max) {
    var Range = Max - Min;
    var Rand = Math.random();
    var num = Min + Math.round(Rand * Range); //四舍五入
    return num;
}
//左中
export default [
    {
        url: "/bigscreen/countDeviceNum",
        type: "get",
        response: () => {
            const a = Mock.mock({
                success: true,
                data: {
                    alarmNum: '@integer(100, 1000)',
                    offlineNum: '@integer(0, 50)',
                    totalNum: 698
                }
            })
            a.data.onlineNum = a.data.totalNum - a.data.offlineNum
            return a
        }
    },
    //左下
    {
        url: "/bigscreen/leftBottom",
        type: "get",
        response: () => {
            const a = Mock.mock({
                success: true,
                data: {
                    "list|20": [
                        {
                            provinceName: "@province()",
                            cityName: '@city()',
                            countyName: "@county()",
                            createTime: "@datetime('yyyy-MM-dd HH:mm:ss')",
                            deviceId: "6c512d754bbcd6d7cd86abce0e0cac58",
                            userName:"用户名",
                            desc: "升发动机刚回家电话关机发货放假回家发货",
                            "gatewayno|+1": 10000,
                            "onlineState|1": [0, 1],

                        }
                    ]
                }
            })
            return a
        }
    },
    //右上
    {
        url: "/bigscreen/alarmNum",
        type: "get",
        response: () => {
            const a = Mock.mock({
                success: true,
                data: {
                    dateList: ['2021-11', '2021-12', '2022-01', '2022-02', '2022-03', "2022-04"],
                    "numList|6": [
                        '@integer(0, 1000)'
                    ],
                    "numList2|6": [
                        '@integer(0, 1000)'
                    ]
                }
            })
            return a
        }
    },
    // 地图标记城市区域界限
    {
        url: "/bigscreen/geoJson",
        type: "get",
        response: () => {
            const a = Mock.mock({
                success: true,
                data: {
                    "type":"Polygon",
                    "coordinates":[
                        [
                            [117.11668916035856,39.142520814838846],
                            [117.19536812560209,39.14063352088935],
                            [117.18502630285096,39.07848185590941],
                            [117.08870540467903,39.11373408487396],
                            [117.08992208970858,39.11231804051942],
                            [117.07795802025142,39.11105931053888],
                            [117.11668916035856,39.142520814838846]
                        ]
                    ]
                }
            })
            return a
        }
    }
];

